/**
 * 区间输入组件
 * Created by trj on 2019/6/20
 */
import React, { useState } from "react";
import { InputNumber } from "antd";
import _ from "lodash";

const InputRange = (props) => {
  const [start, setStart] = useState(props.value[0] || "");
  const [end, setEnd] = useState(props.value[1] || "");
  const handleStartChange = (value) => {
    setStart(value);
    props.onChange([value, props.value[1]]);
  };
  const handleEndChange = (value) => {
    setEnd(value);
    props.onChange([props.value[0], value]);
  };
  return (
    <div className="input-range" style={{ width: "210px" }}>
      <InputNumber
        onChange={handleStartChange}
        value={start}
        style={{ "margin-right": 0 }}
      />
      <span style={{ padding: "0 4px" }}>至</span>
      <InputNumber onChange={handleEndChange} value={end} />
    </div>
  );
};

export default InputRange;
